using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.IO;

using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;

using Common;
using Authentication.User;

namespace Advert
{
    partial class ViewAdvertCenter : PortalModuleBase, IActionable
    {

        #region Public Methods

        public bool DisplayAudit()
        {
            bool retValue = false;

            if ((string)Settings["auditinfo"] == "Y")
            {
                retValue = true;
            }

            return retValue;
        }

        #endregion

        #region Event Handlers

        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    CenterAdvert.myAdvertModuleId = appLibs.GetModuleIdByName(consts.constSystemPortalId, "advertMana");
                    CenterAdvert.myAdvertTabId = appLibs.GetTabIdByName(PortalId, "advert");

                    CenterAdvert.myClickPortaId = PortalId;
                    CenterAdvert.myClickTabId = TabId;
                    CenterAdvert.myUserId = UserId;

                    
                    CenterAdvert.myWidth = consts.constAdvertCenterImageWidth;
                    CenterAdvert.myHeight = consts.constAdvertCenterImageHigh;
                    if (!CenterAdvert.GetAdvert(consts.constAdvertCenterPos))
                        this.Parent.Parent.Parent.Visible = false;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }

        }

        #endregion

        #region Optional Interfaces

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Registers the module actions required for interfacing with the portal framework
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        /// <remarks></remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public ModuleActionCollection ModuleActions
        {
            get
            {
                ModuleActionCollection Actions = new ModuleActionCollection();
                Actions.Add(this.GetNextActionID(), Localization.GetString(ModuleActionType.AddContent, this.LocalResourceFile), ModuleActionType.AddContent, "", "", this.EditUrl(), false, SecurityAccessLevel.Edit, true, false);
                return Actions;
            }
        }

        #endregion
    }
}

